﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Forums.SyncService;

namespace Microsoft.Forums.Tests.HelperTools.Stubs
{
    public class SyncControllerStub : ISynchronizationController
    {
        #region ISynchronizationController Members
        public event EventHandler<SynchronizeForumCompletedEventArgs> SynchronizeForumCompleted;
        public event EventHandler<SynchronizeThreadCompletedEventArgs> SynchronizeThreadCompleted;
        /// <summary>
        /// Determines whether the specified forum is synchronizing.
        /// </summary>
        /// <param name="forumId">The forum id.</param>
        /// <returns>
        /// 	<c>true</c> if the specified forum  is synchronizing; otherwise, <c>false</c>.
        /// </returns>
        public bool IsSynchronizing(Guid forumId)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Retrieve a collection of the forums service provider we have available
        /// </summary>
        /// <value></value>
        public IList<Microsoft.Forums.ForumsProvider.IForumServiceProvider> ServiceProviders
        {
            get { throw new NotImplementedException(); }
        }

        /// <summary>
        /// Gets a collection of all the forums
        /// </summary>
        /// <param name="brand"></param>
        /// <param name="locale"></param>
        /// <returns></returns>
        public IList<Microsoft.Forums.OfflineStore.Forum> GetAvailableForums(string brand, int locale)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Get a collection of all the supported brands
        /// </summary>
        /// <value></value>
        /// <returns>collection of brands</returns>
        public IList<string> SupportedBrands
        {
            get { throw new NotImplementedException(); }
        }

        /// <summary>
        /// Get a collection of all the supported locales
        /// </summary>
        /// <value></value>
        /// <returns>collection of locales</returns>
        public IList<KeyValuePair<int, string>> SupportedLocales
        {
            get { throw new NotImplementedException(); }
        }

        /// <summary>
        /// Adds a Forum to the local store.
        /// In order to call this you must pass in the Forum object you want to add and
        /// a ForumPropertySet object which sets the different properties for the Forum
        /// </summary>
        /// <param name="forum">The forum to subscribe to</param>
        /// <param name="propertySet">The user configurable properties for this forum</param>
        public void SubscribeToForum(Microsoft.Forums.OfflineStore.Forum forum, Microsoft.Forums.OfflineStore.ForumPropertySet propertySet)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Remove a Forum (and all associated Post data) from the local store
        /// </summary>
        /// <param name="forumId">The forum to unsubscribe from</param>
        public void UnsubscribeFromForum(Guid forumId)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// This method cancels an asynchronous operation give the forum id involved
        /// </summary>
        /// <param name="forumId">Id of forum involved in asynchrnous operation</param>
        public void CancelSynchronization(Guid forumId)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Synchronize all subscribe Forums which are in the database.
        /// This sync uses the forum table's LastSyncedOn field to determine date to get update from
        /// </summary>
        /// <param name="forumId"></param>
        /// <returns>
        /// A summary object which indicates what was synchronized
        /// </returns>
        public SynchronizeForumSummary SynchronizeForum(Guid forumId)
        {
            throw new NotImplementedException();
            //return new SynchronizeForumSummary(forumId );
        }

        /// <summary>
        /// Synchronize the given forum asynchronously.
        /// </summary>
        /// <param name="forumId">Id of the forum to synchronize</param>
        public void SynchronizeForumAsync(Guid forumId)
        {
            
        }

        /// <summary>
        /// Synchronize a specific thread given a local Thread object.
        /// This sync uses the thread table's LastSyncedOn field to determine date to get update from
        /// </summary>
        /// <param name="threadId"></param>
        /// <returns>
        /// A summary object which indicates what was synchronized
        /// </returns>
        public SynchronizeThreadSummary SynchronizeThread(Guid threadId)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Synchronize the given forum asynchronously.
        /// </summary>
        /// <param name="threadId">Id of the thread to synchronize</param>
        public void SynchronizeThreadAsync(Guid threadId)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// This deletes all data in that Forum which is stored locally.
        /// It will then synchronize all data for that Forum which has been updated since
        /// the forum's SynchFrom value which is store in the database
        /// </summary>
        /// <param name="forumId"></param>
        public void ResetForum(Guid forumId)
        {
            throw new NotImplementedException();
        }

        #endregion

        /// <summary>
        /// Initializes a new instance of the <see cref="SyncControllerStub"/> class.
        /// </summary>
        public SyncControllerStub()
        {
        }

        /// <summary>
        /// Called when [synchronize completed].
        /// </summary>
        void OnSynchronizeFOrumCompleted()
        {
            if (SynchronizeForumCompleted != null)
            {
                SynchronizeForumCompleted(null, null); 
            }
        }
        /// <summary>
        /// Called when [synchronize completed].
        /// </summary>
        void OnSynchronizeThreadCompleted()
        {
            if (SynchronizeThreadCompleted != null)
            {
                SynchronizeThreadCompleted(null, null);
            }
        }

        #region ISynchronizationController Members


        public void ProcessPendingActionQueue()
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
